/* eslint-disable */
import { SUB_APP_MOCK } from "@/store/mutation-types";
import { isIE } from "@/utils/util";
import storage from "store";
const config = require("../../config/dev.config");


// 判断环境不是 prod 或者 preview 是 true 时，加载 mock 服务
if (config.useMock) {
  if (process.env.NODE_ENV !== "production" || process.env.VUE_APP_PREVIEW === "true") {
    if (isIE()) {
      console.error("ERROR: `mockjs` NOT SUPPORT `IE` PLEASE DO NOT USE IN `production` ENV.");
    }
    // 使用同步加载依赖
    // 防止 vuex 中的 GetInfo 早于 mock 运行，导致无法 mock 请求返回结果
    console.log("subapp mock mounting");
    const Mock = require("mockjs2");
    require("./services/base");
    require("./services/tenantManagement");
    require("./services/supperManagement");

    Mock.setup({
      timeout: 800, // setter delay time
    });
    console.log("mock mounted");
  }
}
